<!DOCTYPE html>
<html lang="zh">

<head>
	<meta charset="utf-8">
	<title>li</title>
	<style>
		*{
			padding: 0; margin: 0;
		}
		
	</style>
</head>

<body>
	<div id="app">
		<h1>日常工作列表:</h1>
		<input type="text" v-model="inputVul" @keyup.enter="Myadd"><button id="btn" @click="Myadd">添加</button>
		<ul>
			<li v-for="(item,index) in workli">序号{{index+1}}:{{item}}<span @click="Mydelete(index)">×</span></li>
		</ul>
	</div>
	<script src="./js/vue.js"></script>
	<script>
		let app = new Vue({
			el: "#app",
			data: {
				inputVul: "",
				workli:["吃饭","睡觉","打豆豆"]
			},
			methods:{
				Mydelete:function(index){
					this.workli.splice(index,1)
				},
				Myadd:function(){
					this.workli.push(this.inputVul)
					this.inputVul=""
				}
			}
		})
	</script>
</body>

</html>